package day16.myclassloader01;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @author Xiao
 * @date 2021/8/10
 */
public class ClassLoaderDemo02 {
    /**
     * 类加载器常用方法
     *  public static ClassLoader getSystemClassLoader()    获取系统类加载器
     *  public InputStream getResourceAsStream(String name) 加载某一个资源文件
     */
    public static void main(String[] args) throws IOException {
        ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
        InputStream is = systemClassLoader.getResourceAsStream(
                "prop.properties");
        Properties prop = new Properties();
        prop.load(is);
        System.out.println(prop);
        is.close();
    }
}
